import axios from "axios";

const instance = axios.create({
  baseURL: import.meta.env.VITE_APP_BASE_API,
  timeout: 10000,
  headers: { "Content-Type": "application/json;charset=utf-8" },
});

instance.interceptors.request.use(
  (config) => {
    config.headers.token =
      "eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJhdWQiOiIySFVBSFNEVUFHWURHQURTTksifQ.nfa5zbgkkftn3jIL40BfRVaZAomN4xm9msUrpZflesA";
    return config;
  },
  (error) => {
    return Promise.reject(error);
  }
);

instance.interceptors.response.use(
  (response) => {
    console.log("response", response);

    return response.data;
  },
  (error) => {
    return Promise.reject(error.msg);
  }
);

export default instance;
